gdk_pixbuf_get_from_source: only reuse surfaces with matching format
authorClaudio Saavedra <csaavedra@igalia.com>
Fri, 6 Sep 2013 15:44:57 +0000 (18:44 +0300)
committerClaudio Saavedra <csaavedra@igalia.com>
Fri, 6 Sep 2013 15:50:07 +0000 (18:50 +0300)
Otherwise the conversion functions will return rubbish.

https://bugzilla.gnome.org/show_bug.cgi?id=707445

gdk/gdkpixbuf-drawable.c

index 59698f8ac0238640b6fb1a50ab68cdd5caf7c962..b6d238e390ad0aea8cf0e1cea06d66a9e0c1a219 100644 (file)
@@ -248,7 +248,8 @@ gdk_pixbuf_get_from_surface  (cairo_surface_t *surface,
                          8,
                          width, height);
 
-  if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE)
+  if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE &&
+      cairo_image_surface_get_format (surface) == gdk_cairo_format_for_content (content))
     surface = cairo_surface_reference (surface);
   else
     {